package com.colin.aiyi.adapter;


import android.content.Context;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.colin.aiyi.R;
import com.colin.aiyi.app.Constant;
import com.colin.aiyi.entity.Chudao;
import com.colin.aiyi.entity.SayDetail;
import com.colin.aiyi.entity.YiMing;

import java.util.ArrayList;
import java.util.List;


public class MeAdapter extends BaseQuickAdapter<Chudao.UrlsBean,BaseViewHolder> {

    public MeAdapter() {
        super(R.layout.item_me);
       // this.context = context;
    }

//    @Override
//    public int getParentPosition(@NonNull YiMing.DataBean.UrlsBean item) {
//        return super.getParentPosition(item);
//    }

    @Override
    protected void convert(BaseViewHolder helper, final Chudao.UrlsBean item) {
        helper.addOnClickListener(R.id.button);
        if (item.isLast()){
            helper.getView(R.id.button).getBackground().setLevel(1);
        }else {
            helper.getView(R.id.button).getBackground().setLevel(0);
        }
        if (item.isFrist()){
            helper.getView(R.id.button).setVisibility(View.VISIBLE);
        }else {
            helper.getView(R.id.button).setVisibility(View.INVISIBLE);
        }

        helper.setText(R.id.edit, item.getUrl());
        ((EditText) helper.getView(R.id.edit)).addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                item.setUrl(s.toString());
            }
        });
    }
}
